<template>

    <div>
        <el-form :inline="false" ref="form" label-width="100px"
            style=" display: flex;flex-direction: column;margin-top: 20px;">
            <el-form-item style="width: 80%;" label="群发任务名称" prop="title">
                <el-input placeholder="请输入群发任务名称" v-model="title"></el-input>
            </el-form-item>
            <el-form-item style="width: 80%;" label="选择客户" prop="external_userid">


                <el-tabs v-model="activeName" type="card" @tab-click="handleClick">

                    <el-tab-pane label="条件筛选" name="second">
                        <!--时间-->
                        <div style="display: flex;margin-top: 30px;">
                            <span class="demonstration">时间：</span>
                            <el-form-item label="" prop="create_time">
                                <el-date-picker
                                        v-model="create_time"
                                        type="daterange"
                                        align="right"
                                        size="mini"
                                        unlink-panels
                                        range-separator="至"
                                        start-placeholder="开始日期"
                                        end-placeholder="结束日期"
                                        format="yyyy-MM-dd"
                                        value-format="yyyy-MM-dd HH:mm:ss"
                                        :default-time="['00:00:00', '23:59:59']"
                                        :picker-options="pickerOptions">
                                </el-date-picker>
                            </el-form-item>
                        </div>
                        <!--所属员工-->
                        <div style="display: flex;margin-top: 30px;">
                            <span class="demonstration">选择员工：</span>
                            <el-button type="primary" size="small" @click="chose_yuangong">选择员工</el-button>
                        </div>
                        <!--含有标签-->
                        <div style="display: flex;margin-top: 30px;">
                            <span class="demonstration">含有标签：</span>
                            <el-button type="primary" size="mini" @click="chose_biaoqian">选择标签</el-button>
                        </div>
                        <!--含有标签-->
                        <div style="display: flex;margin-top: 30px;">
                            <span class="demonstration">不含标签：</span>
                            <el-button type="primary" size="mini" @click="no_chose_biaoqian">选择标签</el-button>
                        </div>
                        <div style="display: flex;margin-top: 30px;flex-direction: column;">
                             <el-checkbox v-model="checked" >允许员工调整发送范围</el-checkbox>
                             <span class="demonstration">人数：{{chose_num}}</span>
                        </div>
                        
                    </el-tab-pane>
                    <el-tab-pane label="指定客户" name="third">
                        <div style="display: flex;margin-top: 30px;">
                            <span class="demonstration">选择客户：</span>
                            <el-button type="primary" size="mini" @click="chose_kehu">选择客户</el-button>
                        </div>
                        <div style="display: flex;margin-top: 30px;flex-direction: column;">
                             <el-checkbox v-model="checked" >允许员工调整发送范围</el-checkbox>
                             <span class="demonstration">人数：{{chose_num}}</span>
                        </div>
                    </el-tab-pane>
                    <el-tab-pane label="全部客户" name="first">
                        <div
                                style="display: flex;flex-direction: column;">
                            <el-checkbox v-model="checked" >允许员工调整发送范围</el-checkbox>
                            <span class="demonstration">人数：{{chose_num}}</span>
                        </div>

                    </el-tab-pane>
                </el-tabs>
                
                
               


            </el-form-item>
            
            
            
           
        </el-form>


        <!--选择员工1-->
        <el-dialog v-dialogDrag :visible.sync="yuangongopen" width="60%" height="600px" append-to-body title="选择员工">

            <div class="biaoqian_content">
                <!--选择员工-->
                <div class="biaoqian_left_content">
                    <div class="biaoqian_left_content_title">
                        <el-input placeholder="请输入关键字" v-model="addbiaoqianform.title"></el-input>
                        <el-button type="primary" size="mini" @click="querybiaoqian_yuangong">查询1</el-button>
                        <el-button size="mini" @click="resetbiaoqian">重置</el-button>
                    </div>
                    <div class="biaoqian_left_content_content">
                        <div class="biaoqian_left_content_content_item" v-for="item in biaoqianlist"
                            :key="item.groups.id">
                            <div class="biaoqian_left_content_content_item_title">{{ item.groups.name }}</div>
                            <div class="biaoqian_left_content_content_item_content2">
                                <div class="biaoqian_left_content_content_item_content" v-for="item2 in item.tags"
                                    :key="item2.id">
                                    <div @click="clickbiaoqian(item.groups, item2)"
                                        :class="item2.click == 1 ? 'biaoqian_left_content_content_item_content_title2' : 'biaoqian_left_content_content_item_content_title'">
                                        {{ item2.name }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
                <!--已选标签-->
                <div class="biaoqian_right_content">
                    <div>已选 {{ biaoqianlist_hav_count }} <span style="color:red">点击删除</span></div>
                    <div class="biaoqian_right_content_item">
                        <!-- <div class="biaoqian_right_content_item_top">点击删除</div> -->
                        <div class="biaoqian_right_content_item_contnet">
                            <div @click="clickbiaoqiandel(item2.groups, item2.tags, index2)"
                                class="biaoqian_left_content_content_item_content_title"
                                v-for="(item2, index2) in biaoqianlist_hav" :key="index2">
                                {{ item2.tags.name }}
                            </div>

                        </div>
                    </div>
                </div>

            </div>

            <div slot="footer" class="dialog-footer">
                <el-button @click="yuangongopen = false" size="small">取 消</el-button>
                <el-button type="primary" @click="submitbiaoqianForm" size="small">确
                    定</el-button>
            </div>

        </el-dialog>
        
        
        <!--选择  包含的 企业标签  含有标签3  -->
        <el-dialog v-dialogDrag :visible.sync="xuan_biaoqian_open" width="60%" height="600px" append-to-body title="选择标签">
        
            <div class="biaoqian_content">
                <!--选择员工-->
                <div class="biaoqian_left_content">
                    <div class="biaoqian_left_content_title">
                        <el-input placeholder="请输入关键字" v-model="addbiaoqianform2.title"></el-input>
                        <el-button type="primary" size="mini" @click="querybiaoqian_qiye">查询</el-button>
                        <el-button size="mini" @click="resetbiaoqian_qiye">重置</el-button>
                    </div>
                    <div class="biaoqian_left_content_content">
                        <div class="biaoqian_left_content_content_item" v-for="item in biaoqianlist_qiye"
                            :key="item.groups.id">
                            <div class="biaoqian_left_content_content_item_title">{{ item.groups.name }}</div>
                            <div class="biaoqian_left_content_content_item_content2">
                                <div class="biaoqian_left_content_content_item_content" v-for="item2 in item.tags"
                                    :key="item2.id">
                                    <div @click="clickbiaoqian_qiye(item.groups, item2)"
                                        :class="item2.click == 1 ? 'biaoqian_left_content_content_item_content_title2' : 'biaoqian_left_content_content_item_content_title'">
                                        {{ item2.name }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
        
                </div>
                <!--已选标签-->
                <div class="biaoqian_right_content">
                    <div>已选 {{ biaoqianlist_hav_count_qiye }} <span style="color:red">点击删除</span></div>
                    <div class="biaoqian_right_content_item">
                        <!-- <div class="biaoqian_right_content_item_top">点击删除</div> -->
                        <div class="biaoqian_right_content_item_contnet">
                            <div @click="clickbiaoqiandel_qiye(item2.groups, item2.tags, index2)"
                                class="biaoqian_left_content_content_item_content_title"
                                v-for="(item2, index2) in biaoqianlist_hav_qiye" :key="index2">
                                {{ item2.tags.name }}
                            </div>
        
                        </div>
                    </div>
                </div>
        
            </div>
        
            <div slot="footer" class="dialog-footer">
                <el-button @click="xuan_biaoqian_open = false" size="small">取 消</el-button>
                <el-button type="primary" @click="submitbiaoqianForm" size="small">确
                    定</el-button>
            </div>
        
        </el-dialog>
        
        
        <!--选择  不含的 企业标签   不含标签4  -->
        <el-dialog v-dialogDrag :visible.sync="xuan_biaoqian_open_no" width="60%" height="600px" append-to-body title="选择标签">
        
            <div class="biaoqian_content">
                <!--选择员工-->
                <div class="biaoqian_left_content">
                    <div class="biaoqian_left_content_title">
                        <el-input placeholder="请输入关键字" v-model="addbiaoqianform3.title"></el-input>
                        <el-button type="primary" size="mini" @click="querybiaoqian_qiye_no">查询</el-button>
                        <el-button size="mini" @click="resetbiaoqian_qiye_no">重置</el-button>
                    </div>
                    <div class="biaoqian_left_content_content">
                        <div class="biaoqian_left_content_content_item" v-for="item in biaoqianlist_qiye_no"
                            :key="item.groups.id">
                            <div class="biaoqian_left_content_content_item_title">{{ item.groups.name }}</div>
                            <div class="biaoqian_left_content_content_item_content2">
                                <div class="biaoqian_left_content_content_item_content" v-for="item2 in item.tags"
                                    :key="item2.id">
                                    <div @click="clickbiaoqian_qiye_no(item.groups, item2)"
                                        :class="item2.click == 1 ? 'biaoqian_left_content_content_item_content_title2' : 'biaoqian_left_content_content_item_content_title'">
                                        {{ item2.name }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
        
                </div>
                <!--已选标签-->
                <div class="biaoqian_right_content">
                    <div>已选 {{ biaoqianlist_hav_count_qiye_no }} <span style="color:red">点击删除</span></div>
                    <div class="biaoqian_right_content_item">
                        <!-- <div class="biaoqian_right_content_item_top">点击删除</div> -->
                        <div class="biaoqian_right_content_item_contnet">
                            <div @click="clickbiaoqiandel_qiye(item2.groups, item2.tags, index2)"
                                class="biaoqian_left_content_content_item_content_title"
                                v-for="(item2, index2) in biaoqianlist_hav_qiye_no" :key="index2">
                                {{ item2.tags.name }}
                            </div>
        
                        </div>
                    </div>
                </div>
        
            </div>
        
            <div slot="footer" class="dialog-footer">
                <el-button @click="xuan_biaoqian_open_no = false" size="small">取 消</el-button>
                <el-button type="primary" @click="submitbiaoqianForm" size="small">确
                    定</el-button>
            </div>
        
        </el-dialog>
        
        
        <!--选择客户-->
        <el-dialog v-dialogDrag :visible.sync="xuan_biaoqian_open_kehu" width="60%" height="600px" append-to-body title="选择标签">
        
            <div class="biaoqian_content">
                <!--选择客户-->
                <div class="biaoqian_left_content">
                    <div class="biaoqian_left_content_title">
                        <el-input placeholder="请输入关键字" v-model="addbiaoqianform4.title"></el-input>
                        <el-button type="primary" size="mini" @click="querybiaoqian_kehu">查询</el-button>
                        <el-button size="mini" @click="resetbiaoqian">重置</el-button>
                    </div>
                    <div class="biaoqian_left_content_content">
                        <div class="biaoqian_left_content_content_item" v-for="item in biaoqianlist_kehu"
                            :key="item.groups.id">
                            <div class="biaoqian_left_content_content_item_title">{{ item.groups.name }}</div>
                            <div class="biaoqian_left_content_content_item_content2">
                                <div class="biaoqian_left_content_content_item_content" v-for="item2 in item.tags"
                                    :key="item2.id">
                                    <div @click="clickbiaoqian_kehu(item.groups, item2)"
                                        :class="item2.click == 1 ? 'biaoqian_left_content_content_item_content_title2' : 'biaoqian_left_content_content_item_content_title'">
                                        {{ item2.name }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
        
                </div>
                <!--已选标签-->
                <div class="biaoqian_right_content">
                    <div>已选 {{ biaoqianlist_hav_count_kehu }} <span style="color:red">点击删除</span></div>
                    <div class="biaoqian_right_content_item">
                        <!-- <div class="biaoqian_right_content_item_top">点击删除</div> -->
                        <div class="biaoqian_right_content_item_contnet">
                            <div @click="clickbiaoqiandel_kehu(item2.groups, item2.tags, index2)"
                                class="biaoqian_left_content_content_item_content_title"
                                v-for="(item2, index2) in biaoqianlist_hav_kehu" :key="index2" >
                                {{ item2.groups.name }} --{{ item2.tags.name }} 
                            </div>
                            <br>
        
                        </div>
                    </div>
                </div>
        
            </div>
        
            <div slot="footer" class="dialog-footer">
                <el-button @click="xuan_biaoqian_open_kehu = false" size="small">取 消</el-button>
                <el-button type="primary" @click="submitbiaoqianForm" size="small">确
                    定</el-button>
            </div>
        
        </el-dialog>
        
        <!--邀约内容-->
        <!-- <div class="yaoyue_neirong_content">
            <div class="yaoyue_neirong_content_title">群发内容</div>
            <div class="yaoyue_neirong_content_body">
                 <editor  v-model="content2"  :childInfo= plan_id  :height="480" v-on:test="test1" @click="test" />
            </div>
        </div> -->
		
		<select-img :show="IsShowPicDig" @update="cleanDiagimage" :selectType="imgnum" @selectSure="selectImgs"
		    :type="0"></select-img>
		<select-img :show="IsShowPicDigVideo" @update="cleanDiagvideo" :selectType="imgnumvideo"
		    @selectSure="lotteryImgs" :type="2"></select-img>
		<select-img :show="IsShowPicDigFile" @update="cleanDiagFile" :selectType="imgnumfile" @selectSure="lottfile"
		    :type="1"></select-img>
        
        <el-form :inline="false" ref="form" label-width="100px"
            style=" display: flex;flex-direction: column;margin-top: 20px;">
            <el-form-item label="群发内容">
                <el-input type="textarea" v-model="textarea"></el-input>
            </el-form-item>
        </el-form>
        
        <el-button style="margin-left: 40px;margin-bottom: 20px;" type="primary" size="mini" @click="tankuang">修改附件</el-button>
         
		 <!-- <div class="block">
		 
		     <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNumber"
		                    :page-sizes="[10, 50, 100, 200]" :page-size="pageSize" background layout="total, sizes, prev, pager, next, jumper"
		                    :total="total">
		     </el-pagination>
		 </div> -->
		 <el-dialog :visible.sync="open" width="900px" append-to-body title="修改附件" >
		     <el-form ref="form" :model="form" :rules="rules" label-width="80px">
		         <el-row>
		             
		             <el-col :span="24">
		                 <el-form-item label="图片" prop="image">
		                     <div class="uploadcol">
		                         <div class="uploadborder">
		                             <img v-if="form.image" :src="form.image" width="100%" height="100%" />
		                             <img v-else src="../../../../assets/img/uploadimg.jpg" width="100%" height="100%" />
		                         </div>
		                         <el-button type="primary" @click="openUploadImage()" size="mini"
		                                    style="margin-top:10px">上传图片</el-button>
		                     </div>
		                 </el-form-item>
		             </el-col>
		             <el-col :span="24">
		                 <el-form-item label="视频" prop="video">
		                     <div class="uploadcol">
		                         <div class="uploadborder">
		                             <el-tag v-if="form.video" :lable="form.video" type="danger"  effect="plain" 
		                                     >MP4</el-tag>
		 
		                         </div>
		                         <el-button type="primary" @click="openUploadVideo()" size="mini"
		                                    style="margin-top:10px">上传视频</el-button>
		                     </div>
		                 </el-form-item>
		             </el-col>
		             <el-col :span="24">
		                 <el-form-item label="文件" prop="files">
		                     <div class="uploadcol">
		                         <div class="uploadborder">
		                             <el-tag v-if="form.files" :lable="form.files" type="warning"  effect="plain" size="small"
		                             >File</el-tag>
		 
		                         </div>
		                         <el-button type="primary" @click="openUploadFiles()" size="mini"
		                                    style="margin-top:10px">上传文件</el-button>
		                     </div>
		                 </el-form-item>
		             </el-col>
		             <el-col :span="30">
		                 <el-form-item label="网页" prop="url">
		                     <el-input v-model="form.url" placeholder="请输入网页地址" size="small" />
		                 </el-form-item>
		             </el-col>
		             <el-col :span="24">
		                 <el-form-item label="使用员工" v-if="userList.length > 0">
		                     <el-checkbox-group v-model="form.checkList">
		                         <el-checkbox v-for="(item, index) in userList"  :key="index" :label="item.userid" :disabled="(item.disabled)" :checked="(item.checked)"> {{ item.name }}</el-checkbox>
		                     </el-checkbox-group>
		                 </el-form-item>
		             </el-col>
		         </el-row>
		     </el-form>
		     <div slot="footer" class="dialog-footer">
		         <el-button @click="open = false" size="small">取 消</el-button>
		         <el-button type="primary" @click="!form.id ? submitForm('form') : subEditForm('form') " size="small">确 定</el-button>
		     </div>
		 
		 </el-dialog>
		 <!-- 图片 -->
		 <el-dialog :visible.sync="openImage" width="900px" append-to-body :title=" '添加图片'">
		     <el-form ref="resForm" :model="resForm"  label-width="80px">
		         <el-table :data="tableDataImage" style="width: 100%;margin-bottom: 20px;" row-key="id" border stripe default-expand-all
		                   v-loading="loading" @selection-change="handleSelectionChangeImage">
		             <el-table-column type="selection" width="55">
		             </el-table-column>
		             <el-table-column prop="id" label="ID" width="55"></el-table-column>
		             <el-table-column prop="name" label="名称"> </el-table-column>
		             <el-table-column prop="src" label="素材图片">
		                 <template slot-scope="scope">
		                     <el-image :src="scope.row.src" fit="fill" style="width: 60px;height: 60px;"></el-image>
		                 </template>
		             </el-table-column>
		         </el-table>
		 
		         <div class="block">
		 
		             <el-pagination @size-change="handleSizeChangeImage" @current-change="handleCurrentChangeImage" :current-page="pageNumber_image"
		                            :page-sizes="[10, 50, 100, 200]" :page-size="pageSize_image" background layout="total, sizes, prev, pager, next, jumper"
		                            :total="total_image">
		             </el-pagination>
		         </div>
		     </el-form>
		     <div slot="footer" class="dialog-footer">
		         <el-button @click="openImage = false" size="small">取 消</el-button>
		         <el-button type="primary" @click=" submitImageForm('resForm')  " size="small">确 定</el-button>
		     </div>
		 </el-dialog>
		 <!-- 视频 -->
		 <el-dialog :visible.sync="openVideo" width="900px" append-to-body :title=" '添加视频'">
		     <el-form ref="resForm" :model="resFormVideo"  label-width="80px">
		         <el-table :data="tableDataVideo" style="width: 100%;margin-bottom: 20px;" row-key="id" border stripe default-expand-all
		                   v-loading="loading" @selection-change="handleSelectionChangeVideo">
		             <el-table-column type="selection" width="55">
		             </el-table-column>
		             <el-table-column prop="id" label="ID" width="55"></el-table-column>
		             <el-table-column prop="name" label="名称"> </el-table-column>
		             <el-table-column prop="media_id" label="素材ID"> </el-table-column>
		         </el-table>
		 
		         <div class="block">
		 
		             <el-pagination @size-change="handleSizeChangeVideo" @current-change="handleCurrentChangeVideo" :current-page="pageNumber_video"
		                            :page-sizes="[10, 50, 100, 200]" :page-size="pageSize_video" background layout="total, sizes, prev, pager, next, jumper"
		                            :total="total_video">
		             </el-pagination>
		         </div>
		     </el-form>
		     <div slot="footer" class="dialog-footer">
		         <el-button @click="openVideo = false" size="small">取 消</el-button>
		         <el-button type="primary" @click=" submitVideoForm('resFormVideo')  " size="small">确 定</el-button>
		     </div>
		 </el-dialog>
		 <!--上传文件-->
		 <el-dialog :visible.sync="openFiles" width="900px" append-to-body :title=" '添加文件'">
		     <el-form ref="resForm" :model="resFormFiles"  label-width="80px">
		         <el-table :data="tableDataFiles" style="width: 100%;margin-bottom: 20px;" row-key="id" border stripe default-expand-all
		                   v-loading="loading" @selection-change="handleSelectionChangeFiles">
		             <el-table-column type="selection" width="55">
		             </el-table-column>
		             <el-table-column prop="id" label="ID" width="55"></el-table-column>
		             <el-table-column prop="name" label="名称"> </el-table-column>
		             <el-table-column prop="media_id" label="素材ID"> </el-table-column>
		 
		         </el-table>
		         <div class="block">
		             <el-pagination @size-change="handleSizeChangeFiles" @current-change="handleCurrentChangeFiles" :current-page="pageNumber_files"
		                            :page-sizes="[10, 50, 100, 200]" :page-size="pageSize_files" background layout="total, sizes, prev, pager, next, jumper"
		                            :total="total_files">
		             </el-pagination>
		         </div>
		     </el-form>
		     <div slot="footer" class="dialog-footer">
		         <el-button @click="openFiles = false" size="small">取 消</el-button>
		         <el-button type="primary" @click=" submitFilesForm('resFormFiles')  " size="small">确 定</el-button>
		     </div>
		 </el-dialog>

        <div style="width: 80%;display: flex;justify-content: center;margin-top: 40px;">
            <el-button size="small" @click="goback">返回</el-button>
            <!-- <el-button type="primary" size="small" @click="savepublish">更新</el-button> -->
            <el-button type="primary" size="small" @click="save_queding">更新</el-button>
        </div>

    </div>
</template>


<script>
    // import Editor from "./quill";
    import Editor from "./test";
    import {
        VueEditor
    } from "vue2-editor";
    import {
        querycontent,
        querytagUser,
        queryUser,
        querybiaoqian,
        savepublish,
        ordertime_queryUser,
        get_client,
        queryyuangong,
        querybiaoqian_qiye,
        querybiaoqian_qiye_no,
        querybiaoqian_kehu,
        save_plan,
        get_plan,
        update_plan,
    } from '@/api/scrm/qunfa/qunfa';
    import debounce from '@/common/debounce.js'
    import PersButton from '@/components/PersButton';
	import Panle from '@/components/Panle.vue';
	import {
	  getFiles,
	  getImage, 
	  getVideo
	} from "@/api/scrm/staff/greeting";
	import SelectImg from "@/components/select-img.vue";

    export default {
        components: {
            PersButton,
            Editor,
			VueEditor,
			SelectImg,
			 Panle,
        },
        data() {
            return {
                create_time:'',
				fullscreenLoading:false,
				open:false,
				textarea:'',
				IsShowPicDig: false,
				form: {
				    name: "",
				    content: "",
				    pageSize: 10,
				    pageNumber: 1,
				    total: 0,
				    im_url: "",
				},
				
                textarea:'',
                checked:'',
                content2: "",
                activeName: 'second',
                chose_num: 0,
                chose_info: [],
                radio1: 0,
                tiaojian: {
                    type: 'all',
                },

                textarea: '',
                title: '',
                wx_name2: '',
                sender: this.$route.query.sender,
                sendername: this.$route.query.sendername,
                senddata_count: 0,
                senddata: [],
                addbiaoqianform: {
                    title: ''
                },
                addbiaoqianform2: {
                    title: ''
                },
                addbiaoqianform3: {
                    title: ''
                },
                addbiaoqianform4: {
                    title: ''
                },
                biaoqianlist: [],
                biaoqianlist_hav: [],
                biaoqianlist_hav_count: 0,
                
                biaoqianlist_qiye: [],
                biaoqianlist_hav_qiye: [],
                biaoqianlist_hav_count_qiye: 0,
                
                biaoqianlist_qiye_no: [],
                biaoqianlist_hav_qiye_no: [],
                biaoqianlist_hav_count_qiye_no: 0,
                
                biaoqianlist_kehu: [],
                biaoqianlist_hav_kehu: [],
                biaoqianlist_hav_count_kehu: 0,
                
                
                biaoqianopen: false,
                yuangongopen: false,
                xuan_biaoqian_open:false,
                xuan_biaoqian_open_no:false,
                xuan_biaoqian_open_kehu:false,
                pickerOptions: {
                    shortcuts: [{
                        text: '最近一周',
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近一个月',
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近三个月',
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                            picker.$emit('pick', [start, end]);
                        }
                    }]
                },
                adddate: '',
                liveId: this.$route.query.liveId,
                venue: this.$route.query.venue,
                content: {
                    sender: this.$route.query.sender,
                    liveId: this.$route.query.liveId
                },
                ordertime_biaoqianopen: false,
                ordertime_adddate: '',
                ordertime_biaoqianlist: [],
                ordertime_biaoqianlist_hav: [],
                ordertime_biaoqianlist_hav_count: 0,
                
                ordertime_biaoqianlist_qiye: [],
                ordertime_biaoqianlist_hav_qiye: [],
                ordertime_biaoqianlist_hav_count_qiye: 0,
                senddata_zhujiao: [],
                
                tab_name:'first',
                quill_info:'',
                plan_id:'',
				//多媒体开始
				userList:[],
				tableDataImage: [],
				tableDataVideo: [],
				tableDataFiles: [],
				openImage:false,
				openVideo:false,
				openFiles:false,
				parentDate: [],
				checkKey: [],
				multipleSelection: [],
				multipleSelectionImage: [],
				multipleSelectionVideo: [],
				multipleSelectionFiles: [],
				loading: false,
				loadingImage: false,
				loadingVideo: false,
				loadingFiles: false,
				// pageSize: 10, //一页显示多少条
				// pageNumber: 1,
				// total: 0, //总页数
				pageSize_image: 10, //一页显示多少条
				pageNumber_image: 1,
				total_image:0,
				pageSize_video: 10, //一页显示多少条
				pageNumber_video: 1,
				total_video:0,
				pageSize_files: 10, //一页显示多少条
				pageNumber_files: 1,
				total_files:0,
				tableData: [],
				tableDataImage: [],
				tableDataVideo: [],
				tableDataFiles: [],
				serachword: '',
				formInline: {},
				resForm:{},
				resFormVideo:{},
				resFormFiles:{},
				form: {
				    "title": "",
				    "content": "",
				    "checkList":[]
				},
				rules: {
				    title: [{
				        required: true,
				        message: "欢迎语名称不能为空",
				        trigger: "blur"
				    }],
				    content: [{
				        required: true,
				        message: "内容不能为空",
				        trigger: "blur"
				    }],
				    
				},
            }
        },
        created() {

            // 或者通过$route获取参数
            this.init();
           

        },

        methods: {
            init() {
                this.loading = true;
                this.tiaojian.type = 'all'
                this.plan_id = this.$route.query.plan_id
                console.log('我是传递进来的plan-id',this.plan_id)
                
                get_client(this.tiaojian).then((res) => {
                    console.log('全部客户', res);
                    this.chose_num = res.data.count
                    this.chose_info = res.data.data
                })

                queryyuangong(this.addbiaoqianform).then((res) => {
                    console.log(res);
                    this.biaoqianlist = res.data.data;
                })
                
                querybiaoqian_qiye(this.addbiaoqianform2).then((res) => {
                    console.log(res);
                    this.biaoqianlist_qiye = res.data.data;
                })
                querybiaoqian_qiye_no(this.addbiaoqianform3).then((res) => {
                    console.log(res);
                    this.biaoqianlist_qiye_no = res.data.data;
                })
                querybiaoqian_kehu(this.addbiaoqianform4).then((res) => {
                    console.log(res);
                    this.biaoqianlist_kehu = res.data.data;
                })
                 get_plan(this.plan_id).then((res) => {
                     console.log('我是父组件的富文本内容11',res.data.plan_info.content)
                     // this.chose_info = res.data.item_info.chose_info,
                     this.title = res.data.plan_info.title,
                     this.textarea = res.data.plan_info.content,
                     this.tab_name = res.data.plan_info.tab_name,
                    this.activeName = res.data.plan_info.tab_name
                    if(res.data.plan_info.range == 1 ){
                        this.checked =true
                    }else{
                        this.checked = false
                    }
                    
                    
                    this.biaoqianlist_hav = res.data.tags
                    this.biaoqianlist_hav_qiye = res.data.tag2
                      // console.log('我是编辑的时候的返回来的选中的数据 含有的企业标签',res.data.tags)
                      // console.log('我是编辑的时候的返回来的选中的数据 含有的企业标签',Object.keys(res.data.tags2))
                      console.log('我是编辑的时候的返回来的选中的数据 含有的企业标签',res.data.tag2)
                    this.biaoqianlist_hav_qiye_no =  res.data.tag3
                    this.biaoqianlist_hav_kehu = res.data.tag4
                    
                     this.loading = false;
                })
               
            },
            test1(e){
                this.quill_info = e
            },
            test(){
                console.log('我是富文本的内容=',this.quill_info )
            },
			tankuang(){
				this.open = true
			},
			//上传图片
			openUploadImage: async function (){
			    let param = {
			        "pageSize": this.pageSize_image,
			        "pageNumber": this.pageNumber_image,
			    }
			     const res = await getImage(param);
			     this.tableDataImage  = res.data.list;
			     this.openImage = true;
			     this.total_image = res.data.total;
			     this.loadingImage = false;
			     this.loading = false;
			
			},
			//上传视频
			openUploadVideo: async function (){
			    let param = {
			        "pageSize": this.pageSize_video,
			        "pageNumber": this.pageNumber_video,
			    }
			     const res = await getVideo(param);
			     this.tableDataVideo  = res.data.list;
			     this.openVideo = true;
			     this.total_video = res.data.total;
			     this.loadingVideo = false;
				 this.loading = false;
			
			},
			//上传文件
			openUploadFiles: async function (){
			    let param = {
			        "pageSize": this.pageSize_files,
			        "pageNumber": this.pageNumber_files,
			    }
			    const res = await getFiles(param);
			    this.tableDataFiles  = res.data.list;
			    this.openFiles = true;
			    this.total_files = res.data.total;
			    this.loadingFiles = false;
				this.loading = false;
			
			},
			handleSizeChange: function(e) {
			    console.log(e);
			    this.pageSize = e;
			    this.init();
			},
			handleSizeChangeImage: function(e) {
			    console.log(e);
			    this.pageSize_image = e;
			    this.init();
			},
			handleSizeChangeVideo: function(e) {
			    console.log(e);
			    this.pageSize_video = e;
			    this.init();
			},
			handleSizeChangeFiles: function(e) {
			    console.log(e);
			    this.pageSize_files = e;
			    this.init();
			},
			handleCurrentChange: function(e) {
			    console.log(e);
			    this.pageNumber = e;
			    this.init();
			},
			handleCurrentChangeImage: function(e) {
			    console.log(e);
			    this.pageNumber_image = e;
			    this.init();
			},
			handleCurrentChangeVideo: function(e) {
			    console.log(e);
			    this.pageNumber_video = e;
			    this.init();
			},
			handleCurrentChangeFiles: function(e) {
			    console.log(e);
			    this.pageNumber_files = e;
			    this.init();
			},
			handleSelectionChange: function(e) {
			    console.log(e);
			    let selectChang = []
			    for (let item of e) {
			        selectChang.push(item.role_id)
			
			    }
			    this.multipleSelection = selectChang;
			    console.log(selectChang);
			},
			handleSelectionChangeImage: function(val) {
			    this.multipleSelectionImage = val;
			},
			handleSelectionChangeVideo: function(val) {
			    this.multipleSelectionVideo = val;
			
			},
			handleSelectionChangeFiles: function(val) {
			    this.multipleSelectionFiles = val;
			},
			
			submitImageForm:function(data){
			    
			    if(this.multipleSelectionImage.length>1){
			        this.msgError('只能选择一张图片');
			        return ;
			    }
			    if(this.multipleSelectionImage.length==0){
			        this.msgError('未选择任何图片');
			        return;
			    }  
			    let image_url = this.multipleSelectionImage[0].src;
			    this.form.image = image_url;
			    this.openImage = false;
			},
			submitVideoForm:function(data){
			
			    if(this.multipleSelectionVideo.length>1){
			        this.msgError('只能选择一个视频');
			        return ;
			    }
			    if(this.multipleSelectionVideo.length==0){
			        this.msgError('未选择任何视频');
			        return;
			    }
			    let video_url = this.multipleSelectionVideo[0].media_id;
			    this.form.video = video_url;
			    this.openVideo = false;
			},
			submitFilesForm:function(data){
			
			    if(this.multipleSelectionFiles.length>1){
			        this.msgError('只能选择一个文件');
			        return ;
			    }
			    if(this.multipleSelectionFiles.length==0){
			        this.msgError('未选择任何文件');
			        return;
			    }
			    let file_url = this.multipleSelectionFiles[0].media_id;
			    this.form.files = file_url;
			    this.openFiles = false;
			},
			
			submitForm:function(data){
			    this.$refs[data].validate((valid) => {
					console.log(999);
					console.log(valid);
					console.log(data);
					console.log(this.form);
					 this.open=false;
			//         if (valid) {
			//             editGree(this.form).then((res)=>{
			//                 if(res.code==200){
			//                     this.msgSuccess(res.msg);
			//                     this.init();
			//                     this.open=false;
			
			//                 }else{
			//                     this.msgError(res.msg);
			//                 }
			//             })
			//         }else{
			//             return false;
			//         }
			    })
			
			},
			
			
			cleanDiagimage: function(shows) {
			    console.log('9999999999', shows)
			    this.IsShowPicDig = false;
			},
			selectImgs: function(res) {
			    console.log('我是返回的图片', res[0].urls)
			    this.IsShowPicDig = true;
			    this.form.im_url = res[0].urls
			    this.form.content += "<img src='" + this.form.im_url + "'/>"
			},
            handleClick(tab, event) {
                console.log('我是第几个标签', tab.name)
                
                this.biaoqianlist_hav_kehu = []
                this.biaoqianlist_hav = []
                this.biaoqianlist_hav_qiye = []
                this.biaoqianlist_hav_qiye_no = []
                
                if (tab.name == 'first') {
                    this.tab_name = 'first'
                    this.tiaojian.type = 'all'
                    get_client(this.tiaojian).then((res) => {
                        console.log('全部客户', res);
                        this.chose_num = res.data.count
                        this.chose_info = res.data.data
                    })
                } else if (tab.name == 'second') {
                    this.tab_name = 'second'
                    get_client(this.tiaojian).then((res) => {
                        console.log('全部客户', res);
                        this.chose_num = res.data.count
                        this.chose_info = res.data.data
                    })
                    // this.chose_num  = 0
                } else if (tab.name == 'third') {
                    this.tab_name = 'third'
                    get_client(this.tiaojian).then((res) => {
                        console.log('全部客户', res);
                        this.chose_num = res.data.count
                        this.chose_info = res.data.data
                    })
                    // this.chose_num  = 0
                }
            },
            querybiaoqian_yuangong(){
                console.log('点击员工查询名字',this.addbiaoqianform)
                queryyuangong(this.addbiaoqianform).then((res) => {
                    console.log(res);
                    this.biaoqianlist = res.data.data;
                })
            },
            querybiaoqian_qiye(){
                querybiaoqian_qiye(this.addbiaoqianform2).then((res) => {
                    console.log(res);
                    this.biaoqianlist_qiye = res.data.data;
                })
            },
            querybiaoqian_qiye_no(){
                querybiaoqian_qiye_no(this.addbiaoqianform3).then((res) => {
                    console.log(res);
                    this.biaoqianlist_qiye_no = res.data.data;
                })
            },
            querybiaoqian_kehu(){
                querybiaoqian_kehu(this.addbiaoqianform4).then((res) => {
                    console.log(res);
                    this.biaoqianlist = res.data.data;
                })
            },
            adduserbybiaoqian() {
                this.biaoqianopen = true;
            },
            chose_yuangong() {
                this.yuangongopen = true;
            },
            chose_biaoqian() {
                this.xuan_biaoqian_open = true;
            },
            no_chose_biaoqian(){
                this.xuan_biaoqian_open_no = true;
            },
            chose_kehu(){
                this.xuan_biaoqian_open_kehu = true;
            },
            
            querybiaoqian() {
                querybiaoqian(this.addbiaoqianform).then((res) => {
                    console.log(res);
                    this.biaoqianlist = res.data;
                })
            },
            resetbiaoqian() {
                this.addbiaoqianform = {
                    title: ''
                };
                this.init();
            },
            resetbiaoqian_qiye() {
                this.addbiaoqianform2 = {
                    title: ''
                };
                this.init();
            },
            resetbiaoqian_qiye_no() {
                this.addbiaoqianform3 = {
                    title: ''
                };
                this.init();
            },
            
            clickbiaoqian(group, tag) {
                let a = {
                    groups: group,
                    tags: tag
                };

                if (this.biaoqianlist_hav.length > 0) {
                    var b = true;
                    this.biaoqianlist_hav.forEach(element => {

                        if (a.tags.tagid == element.tags.tagid) {
                            b = false;
                        }
                    });
                    if (b) {
                        this.biaoqianlist_hav.push(a);
                    }
                } else {
                    this.biaoqianlist_hav.push(a);
                }


                this.biaoqianlist_hav_count = this.biaoqianlist_hav.length;
                this.biaoqianlist[group.groupid]['tags'][tag.tagid].click = 1;
                console.log(this.biaoqianlist[group.groupid]);
            },
            clickbiaoqiandel(group, tag, index) {
            
                this.biaoqianlist_hav.splice(index, 1);
                this.biaoqianlist_hav_count = this.biaoqianlist_hav.length;
                this.biaoqianlist[group.groupid]['tags'][tag.tagid].click = 0;
            
            },
            clickbiaoqian_qiye(group, tag) {
                let a = {
                    groups: group,
                    tags: tag
                };
            
                if (this.biaoqianlist_hav_qiye.length > 0) {
                    var b = true;
                    this.biaoqianlist_hav_qiye.forEach(element => {
            
                        if (a.tags.tagid == element.tags.tagid) {
                            b = false;
                        }
                    });
                    if (b) {
                        this.biaoqianlist_hav_qiye.push(a);
                    }
                } else {
                    this.biaoqianlist_hav_qiye.push(a);
                }
            
            
                this.biaoqianlist_hav_count_qiye = this.biaoqianlist_hav_qiye.length;
                this.biaoqianlist_qiye[group.groupid]['tags'][tag.tagid].click = 1;
                console.log(this.biaoqianlist_qiye[group.groupid]);
            },
            clickbiaoqiandel_qiye(group, tag, index) {
            
                this.biaoqianlist_hav_qiye.splice(index, 1);
                this.biaoqianlist_hav_count_qiye = this.biaoqianlist_hav_qiye.length;
                this.biaoqianlist_qiye[group.groupid]['tags'][tag.tagid].click = 0;
            
            },
            
            clickbiaoqian_qiye_no(group, tag) {
                let a = {
                    groups: group,
                    tags: tag
                };
            
                if (this.biaoqianlist_hav_qiye_no.length > 0) {
                    var b = true;
                    this.biaoqianlist_hav_qiye_no.forEach(element => {
            
                        if (a.tags.tagid == element.tags.tagid) {
                            b = false;
                        }
                    });
                    if (b) {
                        this.biaoqianlist_hav_qiye_no.push(a);
                    }
                } else {
                    this.biaoqianlist_hav_qiye_no.push(a);
                }
            
            
                this.biaoqianlist_hav_count_qiye_no = this.biaoqianlist_hav_qiye_no.length;
                this.biaoqianlist_qiye_no[group.groupid]['tags'][tag.tagid].click = 1;
                console.log(this.biaoqianlist_qiye_no[group.groupid]);
            },
            clickbiaoqiandel_qiye_no(group, tag, index) {
            
                this.biaoqianlist_hav_qiye.splice(index, 1);
                this.biaoqianlist_hav_count_qiye = this.biaoqianlist_hav_qiye.length;
                this.biaoqianlist_qiye[group.groupid]['tags'][tag.tagid].click = 0;
            
            },
            
            
            clickbiaoqian_kehu(group, tag) {
                let a = {
                    groups: group,
                    tags: tag
                };
            
                if (this.biaoqianlist_hav_kehu.length > 0) {
                    var b = true;
                    this.biaoqianlist_hav_kehu.forEach(element => {
            
                        if (a.tags.tagid == element.tags.tagid) {
                            b = false;
                        }
                    });
                    if (b) {
                        this.biaoqianlist_hav_kehu.push(a);
                    }
                } else {
                    this.biaoqianlist_hav_kehu.push(a);
                }
                console.log('我是点击选择客户标签：',this.biaoqianlist_hav_kehu)
                
            
                this.biaoqianlist_hav_count_kehu = this.biaoqianlist_hav_kehu.length;
                this.biaoqianlist_kehu[group.groupid]['tags'][tag.tagid].click = 1;
                console.log(this.biaoqianlist_kehu[group.groupid]);
            },
            clickbiaoqiandel_kehu(group, tag, index) {
            
                this.biaoqianlist_hav_kehu.splice(index, 1);
                this.biaoqianlist_hav_count_kehu = this.biaoqianlist_hav_kehu.length;
                this.biaoqianlist_kehu[group.groupid]['tags'][tag.tagid].click = 0;
            
            },
           
            submitbiaoqianForm() {

                let tags = [];
                let tags2 = [];
                let tags3 = [];
                let tags4 = [];

                if(this.tab_name == 'second'){
                    //员工
                    this.biaoqianlist_hav.forEach(element => {
                        tags.push(element.tags.tagid);
                    });
                    //含有标签
                    this.biaoqianlist_hav_qiye.forEach(element => {
                        tags2.push(element.tags.tagid);
                    });
                    //不含标签
                    this.biaoqianlist_hav_qiye_no.forEach(element => {
                        tags3.push(element.tags.tagid);
                    });
                }
                
                if(this.tab_name == 'third'){
                    //选择客户
                    this.biaoqianlist_hav_kehu.forEach(element => {
                        console.log('选择用户以后的点击事件', element.tags)
                        tags4.push(element.groups.groupid + "*" + element.tags.tagid);
                    });
                }
                
                

                let data_yuangong = {
                    "tags": tags,
                    "tags2": tags2,
                    "tags3": tags3,
                    "tags4": tags4,
                    "create_time":this.create_time
                }
                console.log('我是data1',data_yuangong);
                querytagUser(data_yuangong).then((res) => {
                    console.log(res);
                    // this.biaoqianopen = false;
                    this.yuangongopen = false;
                    this.xuan_biaoqian_open = false;
                    this.xuan_biaoqian_open_no = false;
                    this.xuan_biaoqian_open_kehu = false;
                    
                    this.chose_info   = res.data.data
                    this.chose_num = res.data.count
                    // if (res.data.length == 0) {
                    //     this.$notify({
                    //         title: '警告',
                    //         message: '没有找到该标签下的用户',
                    //         type: 'warning'
                    //     });
                    //     return;
                    // }
                    
                    
                    
                    
                });


            },

            ordertime_adduserbybiaoqian() {
                this.ordertime_biaoqianopen = true;
            },
            ordertime_querybiaoqian() {
                querybiaoqian(this.addbiaoqianform).then((res) => {
                    console.log(res);
                    this.biaoqianlist = res.data;
                })
            },

            ordertime_clickbiaoqian(item) {
                console.log(item);
                if (this.ordertime_biaoqianlist_hav.length > 0) {
                    var a = true;
                    this.ordertime_biaoqianlist_hav.forEach(element => {
                        if (item.id == element.id) {
                            a = false;
                        }
                    });
                    if (a) {
                        this.ordertime_biaoqianlist_hav.push(item);
                    }
                } else {
                    this.ordertime_biaoqianlist_hav.push(item);
                }




                this.ordertime_biaoqianlist_hav_count = this.ordertime_biaoqianlist_hav.length;
                if (item.name == '未邀约') {
                    this.ordertime_biaoqianlist[item.date]['weiyaoyue'].click = 1;
                }
                if (item.name == '未到课') {
                    this.ordertime_biaoqianlist[item.date]['weidaoke'].click = 1;
                }

                console.log(this.ordertime_biaoqianlist);
                console.log(this.ordertime_biaoqianlist_hav);
            },
            ordertime_biaoqian_all() {
                this.ordertime_biaoqian_allweiyaoyue();
                this.ordertime_biaoqian_allweidaoke();
            },
            ordertime_biaoqian_allweiyaoyue() {
                this.ordertime_biaoqianlist = Object.values(this.ordertime_biaoqianlist);
                this.ordertime_biaoqianlist.forEach((item, index) => {
                    if (this.ordertime_biaoqianlist_hav.length > 0) {
                        var a = true;
                        this.ordertime_biaoqianlist_hav.forEach(element2 => {
                            if (item.weiyaoyue.id == element2.id) {
                                a = false;
                            }
                        });
                        if (a) {
                            this.ordertime_biaoqianlist_hav.push(item.weiyaoyue);
                        }
                    } else {
                        this.ordertime_biaoqianlist_hav.push(item.weiyaoyue);
                    }

                    this.ordertime_biaoqianlist_hav_count = this.ordertime_biaoqianlist_hav.length;
                    this.ordertime_biaoqianlist[index]['weiyaoyue'].click = 1;
                });
            },
            ordertime_biaoqian_allweidaoke() {
                this.ordertime_biaoqianlist = Object.values(this.ordertime_biaoqianlist);

                this.ordertime_biaoqianlist.forEach((item, index) => {
                    if (this.ordertime_biaoqianlist_hav.length > 0) {
                        var a = true;
                        this.ordertime_biaoqianlist_hav.forEach(element2 => {
                            if (item.weidaoke.id == element2.id) {
                                a = false;
                            }
                        });
                        if (a) {
                            this.ordertime_biaoqianlist_hav.push(item.weidaoke);
                        }
                    } else {
                        this.ordertime_biaoqianlist_hav.push(item.weidaoke);
                    }

                    this.ordertime_biaoqianlist_hav_count = this.ordertime_biaoqianlist_hav.length;
                    this.ordertime_biaoqianlist[index]['weidaoke'].click = 1;
                });
            },
            ordertime_clickbiaoqiandel(index, item) {

                this.ordertime_biaoqianlist_hav.splice(index, 1);
                this.ordertime_biaoqianlist_hav_count = this.ordertime_biaoqianlist_hav.length;
                if (item.name == '未邀约') {
                    this.ordertime_biaoqianlist[item.date]['weiyaoyue'].click = 0;
                }
                if (item.name == '未到课') {
                    this.ordertime_biaoqianlist[item.date]['weidaoke'].click = 0;
                }

            },

            ordertime_delall() {
                this.$confirm('此操作将删除所有已选标签, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.ordertime_biaoqianlist_hav = [];
                    this.$message({
                        type: 'success',
                        message: '删除成功!'
                    });
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            ordertime_submitbiaoqianForm() {

                if (this.ordertime_biaoqianlist_hav.length <= 0) {
                    this.$notify({
                        title: '警告',
                        message: '至少一个标签',
                        type: 'warning'
                    });
                    return;
                }

                if (this.senddata.length > 0) {

                    this.ordertime_biaoqianlist_hav.forEach(element => {
                        var a = true;
                        this.senddata.forEach(element2 => {
                            element['user'].forEach(element3 => {
                                if (element3.userid == element2.userid) {
                                    a = false;
                                }
                            });

                        });
                        if (a) {
                            element['user'].forEach(element4 => {
                                delete element4['date'];
                                this.senddata.push(element4);
                            });
                        }
                    });
                } else {
                    this.ordertime_biaoqianlist_hav.forEach(element => {
                        element['user'].forEach(element2 => {
                            delete element2['date'];
                            this.senddata.push(element2);
                        });

                    });
                }
                this.senddata_count = this.senddata.length;
                console.log(this.senddata);
                this.ordertime_biaoqianopen = false;
            },

            ordertime_adduserbydate() {
                console.log(this.ordertime_adddate);
                if (this.ordertime_adddate.length != 2) {
                    this.$notify({
                        title: '警告',
                        message: '开始和结束时间不能为空',
                        type: 'warning'
                    });
                    return;
                }
                let data = {
                    "startdate": this.ordertime_adddate[0].toLocaleString('zh-cn'),
                    "enddate": this.ordertime_adddate[1].toLocaleString('zh-cn'),
                    "sender": this.sender,
                    "venue": this.venue,
                }

                ordertime_queryUser(data).then((res) => {
                    console.log(res);
                    if (res.data.length == 0) {
                        this.$notify({
                            title: '警告',
                            message: '没有找到该时间段内的用户',
                            type: 'warning'
                        });
                        return;
                    }
                    this.ordertime_biaoqianlist = res.data.list;
                });
            },

            adduserbydate() {
                console.log(this.adddate);
                if (this.adddate.length != 2) {
                    this.$notify({
                        title: '警告',
                        message: '开始和结束时间不能为空',
                        type: 'warning'
                    });
                    return;
                }
                let data = {
                    "startdate": this.adddate[0].toLocaleString('zh-cn'),
                    "enddate": this.adddate[1].toLocaleString('zh-cn'),
                    "sender": this.sender
                }

                queryUser(data).then((res) => {
                    if (res.data.length == 0) {
                        this.$notify({
                            title: '警告',
                            message: '没有找到该时间段内的用户',
                            type: 'warning'
                        });
                        return;
                    }
                    if (this.senddata.length > 0) {
                        res.data.forEach(element => {
                            var a = true;
                            this.senddata.forEach(element2 => {
                                if (element.userid == element2.userid) {
                                    a = false;
                                }
                            });
                            if (a) {
                                this.senddata.push(element);
                            }
                        });
                    } else {
                        res.data.forEach(element => {
                            this.senddata.push(element);
                        });
                    }
                    this.senddata_count = this.senddata.length;


                    this.senddata.forEach(element => {
                        this.senddata_zhujiao[element.zhujiaoname] = this.senddata_zhujiao[element
                            .zhujiaoname] ? (this.senddata_zhujiao[element.zhujiaoname] + 1) : 1;
                    });

                    var senddata_zhujiao2 = [];
                    this.senddata_zhujiao.forEach((item, index) => {
                        senddata_zhujiao2.push({
                            'a': index,
                            'b': item
                        });
                    });

                    console.log(this.senddata);
                    console.log(this.senddata_zhujiao);
                    console.log(senddata_zhujiao2);
                });
            },
            adduserbyname() {
                console.log(this.wx_name2);
                if (this.wx_name2 == '') {
                    this.$notify({
                        title: '警告',
                        message: '请选输入关键字',
                        type: 'warning'
                    });
                    return;
                }
                let data = {
                    "wx_name": this.wx_name2,
                    "sender": this.sender
                }

                queryUser(data).then((res) => {
                    if (res.data.length == 0) {
                        this.$notify({
                            title: '警告',
                            message: '没有找到该包含关键字的用户',
                            type: 'warning'
                        });
                        return;
                    }
                    if (this.senddata.length > 0) {
                        res.data.forEach(element => {
                            var a = true;
                            this.senddata.forEach(element2 => {
                                if (element.userid == element2.userid) {
                                    a = false;
                                }
                            });
                            if (a) {
                                this.senddata.push(element);
                            }
                        });
                    } else {
                        res.data.forEach(element => {
                            this.senddata.push(element);
                        });
                    }
                    this.senddata_count = this.senddata.length;
                });
            },
            clickkehudel(data) {
                this.senddata.forEach((item, index) => {
                    if (data.userid == item.userid) {
                        this.senddata.splice(index, 1);
                    }
                });
                this.senddata_count = this.senddata.length;
            },
            goback() {
                // this.$router.push({ path: '/live/invitation/invitation?liveId=' + this.liveId });
                // this.$router.go(-1); // 或者 this.$router.back();
                this.$router.back();
            },
            save_queding(){
                this.$confirm('确定更新吗', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                
                    this.savepublish()
                
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消'
                    });
                });
            },
            savepublish() {

                let tags = [];
                let tags2 = [];
                let tags3 = [];
                let tags4 = [];
                
                console.log('我是哪个模块-------',  this.tab_name )
                   
                   if(this.tab_name == 'second'){
                       this.biaoqianlist_hav_kehu = []
                   }
                    
                    if(this.tab_name == 'third'){
                       this.biaoqianlist_hav = []
                       this.biaoqianlist_hav_qiye = []
                       this.biaoqianlist_hav_qiye_no = []
                    }
                    
                    //员工
                    this.biaoqianlist_hav.forEach(element => {
                        tags.push(element.tags.tagid);
                    });
                    //含有标签
                    this.biaoqianlist_hav_qiye.forEach(element => {
                        tags2.push(element.tags.tagid);
                    });
                    //不含标签
                    this.biaoqianlist_hav_qiye_no.forEach(element => {
                        tags3.push(element.tags.tagid);
                    });
                    //选择客户
                    this.biaoqianlist_hav_kehu.forEach(element => {
                        tags4.push(element.groups.groupid + "*" + element.tags.tagid);
                    });
                
                
                
                let data_save = {
                    // "quill_info": this.quill_info,
                     "quill_info": this.textarea,
                    "chose_info": this.chose_info,
                    "title": this.title,
                    "range": this.checked,
                    
                    "tab_name": this.tab_name,
                    "plan_id": this.$route.query.plan_id,
                    
                    
                    "tags":  this.biaoqianlist_hav,
                    "tags2":  this.biaoqianlist_hav_qiye,
                    "tags3":  this.biaoqianlist_hav_qiye_no,
                    "tags4":  this.biaoqianlist_hav_kehu,
					
					"files":this.form.files,
					"image":this.form.image,
					"video":this.form.video,
					"url":this.form.url,
                }
                
                update_plan(data_save).then((res) => {
                    console.log(res);
                    this.$router.back();
                    // this.biaoqianlist = res.data;
                })
                
               


            }



        }

    }
</script>

<style lang="scss" scoped>
    .biaoqian_content {
        display: flex;
        width: 100%;
    }

    .biaoqian_content2 {
        display: flex;
        width: 100%;
    }

    .biaoqian_left_content {
        margin: 10px;
        border-width: 1px;
        border-style: solid;
        border-color: rgb(241, 241, 241);
        display: flex;
        flex-direction: column;
        width: 60%;
        overflow-y: scroll;
        /* 启用垂直滚动 */
        max-height: 500px;
        overflow: auto;
        /* 隐藏滚动条 */
        padding: 20px;
    }

    .biaoqian_right_content {
        margin: 10px;
        border-width: 1px;
        border-style: solid;
        border-color: rgb(180, 180, 180);
        display: flex;
        flex-direction: column;
        width: 30%;
        overflow-y: scroll;
        /* 启用垂直滚动 */
        max-height: 500px;
        overflow: auto;
        /* 隐藏滚动条 */
        padding: 20px;
    }

    .biaoqian_right_content2 {
        margin: 10px;
        border-width: 1px;
        border-style: solid;
        border-color: rgb(180, 180, 180);
        display: flex;
        flex-direction: column;
        width: 100%;
        overflow-y: scroll;
        /* 启用垂直滚动 */
        max-height: 500px;
        overflow: auto;
        /* 隐藏滚动条 */
        padding: 20px;
    }

    .biaoqian_left_content_title {
        display: flex;
    }

    .biaoqian_left_content_content_item_title {
        font-weight: bold;
    }

    .biaoqian_left_content_content {
        display: flex;
        flex-direction: column;
    }

    .biaoqian_left_content_content_item {
        display: flex;
        flex-direction: column;
        margin-top: 20px;
    }

    .biaoqian_left_content_content_item_content2 {
        display: flex;
        margin-bottom: 10px;
        flex-wrap: wrap;
        margin-top: 10px;
    }

    .biaoqian_left_content_content_item_content {
        display: flex;
        padding: 2px;
        margin-left: 10px;
        margin-left: 10px;
    }

    .biaoqian_left_content_content_item_content_title {
        border-color: #dfdfdf;
        border-width: 1px;
        border-style: solid;
        margin: 5px;
        padding: 5px;
        border-radius: 5px;
    }

    .biaoqian_left_content_content_item_content_title2 {
        border-color: blue;
        border-width: 1px;
        border-style: solid;
        margin: 5px;
        padding: 5px;
        border-radius: 5px;
    }

    .biaoqian_right_content_item_top {
        margin-top: 10px;
        margin-bottom: 10px;
        color: red;
    }

    .biaoqian_right_content_item_top2 {
        margin-top: 2px;
        margin-bottom: 10px;
        color: red;
    }

    .biaoqian_right_content_item {
        display: flex;
        flex-direction: column
    }

    .biaoqian_right_content_item_contnet {
        display: flex;
        margin-bottom: 10px;
        flex-wrap: wrap;
        justify-content: space-evenly;
        margin-top: 10px;
    }

    .biaoqian_right_content_label {
        border-color: rgb(245, 247, 251);
        border-width: 1px;
        border-style: solid;
    }

    .demonstration {
        width: 100px;
    }

    .renyuan_content {
        display: flex;
        width: 100%;
    }

    .yaoyue_neirong_content {
        display: flex;
    }


    .yaoyue_neirong_content_body {
        display: flex;
        flex-direction: column;
        border-width: 1px;
        border-style: solid;
        border-color: rgb(180, 180, 180);
        padding: 10px;
        margin-left: 10px;
        width: 90%;
    }

    .yaoyue_neirong_content_title {
        width: 10%;
    }

    .yaoyue_neirong_content {
        width: 80%;
    }
	.uploadborder {
	    border: 1px dashed #d9d9d9;
	    border-radius: 6px;
	    /* cursor: pointer;
	    position: relative;
	    overflow: hidden; */
	    width: 100px;
	    height: 100px;
	}
	
	
</style>